package com.bjb.vr.auth.bo;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * @description:
 * @author: HuJingBo
 * @time: 2022/5/17 21:55
 */
@Data
public class UmsUserDetail implements UserDetails {

    Long userId;

    String loginType;

    String tenantId;

    String username;

    String password;

    boolean enabled;

    boolean requireChangePass;

    Collection<GrantedAuthority> authorities;

    List<String> roles;

    public UmsUserDetail(String username, String password, boolean enabled) {
        this.username = username;
        this.password = password;
        this.enabled = enabled;
    }

    public List<String> getRoles() {
        return roles;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return enabled;
    }
}
